﻿<!DOCTYPE html>
<html lang="zh">
<head>
	<meta charset="UTF-8">
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> 
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
	<title>捕获键盘输入和输入组合键的js库hotkeys</title>
	<link rel="stylesheet" type="text/css" href="css/normalize.css" />
	<link rel="stylesheet" type="text/css" href="css/htmleaf-demo.css">
</head>
<body>
	<div class="htmleaf-container">
		<header class="htmleaf-header">
			<h1>捕获键盘输入和输入组合键的js库hotkeys <span>A robust Javascript library for capturing keyboard input</span></h1>
			<div class="htmleaf-links">
				<a class="htmleaf-icon icon-htmleaf-home-outline" href="http://www.jb51.net/" title="脚本之家" target="_blank"><span> 脚本之家</span></a>
				<a class="htmleaf-icon icon-htmleaf-arrow-forward-outline" href="http://www.jb51.net/" title="返回下载页" target="_blank"><span> 返回下载页</span></a>
			</div>
		</header>
		<h3 class="center">这个页面监听了键盘的ctrl+q，ctrl+b，r，和f键，请按下以上按键查看效果。</h3>

	</div>
	
	<script type="text/javascript" src="dist/hotkeys.min.js"></script>
	<script type="text/javascript">
		// 定义a快捷键
		hotkeys('ctrl+q,ctrl+b,r,f', function(event,handler){
		  switch(handler.key){
		      case "ctrl+q":alert('你按下了ctrl+q!');break;
		      case "ctrl+b":alert('你按下了ctrl+b!');break;
		      case "r":alert('你按下了r!');break;
		      case "f":alert('你按下了f!');break;
		  }
		  //handler.scope 范围
		});
	</script>
</body>
</html>